<?
/*
%%%copyright%%%
 * phpMyTicket - ticket reservation system
 * Copyright (C) 2004-2005 Anna Putrino, Stanislav Chachkov. All rights reserved.
 *
 * This file is part of phpMyTicket.
 *
 * This file may be distributed and/or modified under the terms of the
 * "GNU General Public License" version 2 as published by the Free
 * Software Foundation and appearing in the file LICENSE included in
 * the packaging of this file.
 *
 * Licencees holding a valid "phpmyticket professional licence" version 1
 * may use this file in accordance with the "phpmyticket professional licence"
 * version 1 Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 *
 * The "phpmyticket professional licence" version 1 is available at
 * http://www.phpmyticket.com/ and in the file
 * PROFESSIONAL_LICENCE included in the packaging of this file.
 * For pricing of this licence please contact us via e-mail to 
 * info@phpmyticket.com.
 * Further contact information is available at http://www.phpmyticket.com/
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Contact info@phpmyticket.com if any conditions of this licencing isn't 
 * clear to you.
 
 */
?>
<?
require_once("admin/AdminView.php");
require_once("classes/ShopDB.php");

class ImportView extends AdminView {

	//selected import type
	var $import_type;
	
	//selected import object
	var $import_object;	
	
	//recognized import types
	var $import_types=array('xml');
	
	function ImportView(){
		if($_POST['import_type']) $this->import_type=$_POST['import_type'];
		if($_GET['import_type']) $this->import_type=$_GET['import_type'];
		
		if(in_array($this->import_type,$this->import_types)){
			$import_class='import_'.$this->import_type;
			require_once("admin/$import_class.php");
			$this->import_object = new $import_class;
		}
	}
	
	    
	function import_list(){
		$this->list_head(import_admin_title,1);
		$alt=0;
		foreach($this->import_types as $type){
     echo "<tr class='admin_list_row_$alt'> 
           <td class='admin_list_item'>
					 <a href='?import_type=$type' class='link'>".$this->con('import_'.$type)."</a>
					 </td></tr>
					 ";

		}
		echo "</table>";
	}
	
  function import(){
		if($this->import_object){
			return $this->import_object->import();
		}
		return FALSE;
  }
  
  function draw (){
		if($this->import()){
			//dono
		}elseif($this->import_object){
			$this->import_object->draw();
		}else{
		  $this->import_list();
		}
  }
}
?>
